#!/bin/bash
#Not for LiveCD Implementation, this is the development environment.


sudo add-apt-repository "deb http://archive.canonical.com/ubuntu oneiric partner"
sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe"
sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ oneiric-updates universe"
sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ oneiric multiverse"
sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ oneiric-updates multiverse"

sudo apt-get update
sudo apt-get -y upgrade

sudo apt-get install --no-install-recommends -y xubuntu-desktop
echo “Please reboot now, then rerun this script ignoring this message next time.”
read -p

sudo apt-get install -y openssh-server
sudo apt-get install -y synaptic
sudo apt-get install -y openjdk-7-jre openjdk-7-jdk
sudo apt-get install -y subversion git
sudo apt-get install -y python
sudo apt-get install -y --no-install-recommends gedit

wget http://apache.hoxt.com/tomcat/tomcat-7/v7.0.27/bin/apache-tomcat-7.0.27.tar.gz
tar xvzf apache-tomcat-7.0.27.tar.gz

python -mwebbrowser http://clean-clouds.com/2011/10/19/install-tomcat-7-on-ubuntu/

echo "<tomcat-users>" > apache-tomcat-7.0.27/conf/tomcat-users.xml
echo "<role rolename=\"manager-gui\"/>" >>  apache-tomcat-7.0.27/conf/tomcat-users.xml
echo "<role rolename=\"admin-gui\"/>" >>  apache-tomcat-7.0.27/conf/tomcat-users.xml
echo "<user username=\"sentinel\" password=\"pcedarw\" roles=\"manager,admin\"/>" >>  apache-tomcat-7.0.27/conf/tomcat-users.xml
echo "</tomcat-users>" >>  apache-tomcat-7.0.27/conf/tomcat-users.xml

#End system config

wget http://pypi.python.org/packages/source/p/pyserial/pyserial-2.6.tar.gz
tar -zxvf pyserial-2.6.tar.gz
cd pyserial-2.6/
python setup.py install
cd ../

sudo apt-get -y install gcc-avr avr-libc
sudo apt-get -y install ia32-libs

#https://github.com/adafruit/AccelStepper
#https://github.com/adafruit/Adafruit-Motor-Shield-library
#TODO Add Arduino/motor libraries

wget http://arduino.googlecode.com/files/arduino-1.0-linux.tgz
tar -zxvf arduino-1.0-linux.tgz


#Begin OpenCV dependencies

sudo apt-get install -y build-essential cmake cmake-gui pkg-config libgstreamer0.10-0-dbg libgstreamer0.10-0  libgstreamer0.10-dev libpng12-0 libpng12-dev libpng++-dev libpng3 libpnglite-dev zlib1g-dbg zlib1g zlib1g-dev libjasper-dev libjasper-runtime libjasper1 pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools libjpeg8  ffmpeg libavcodec-dev libavcodec53 libavformat53 libavformat-dev libjpeg8-dev libjpeg8-dbg libjpeg62-dev libjpeg62-dbglibjpeg-progs libxine1-ffmpeg  libxine-dev libxine1-bin libunicap2 libunicap2-dev libdc1394-22-dev libdc1394-22 libdc1394-utils swig libv4l-0 libv4l-dev libgstreamer-plugins-base0.10-dev libgtk2.0-dev


#End OpenCV dependencies

wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2

tar -jxvf OpenCV-2.3.1a.tar.bz2
chmod 777 -R OpenCV-2.3.1

cd OpenCV-2.3.1
mkdir build
cd build
cmake-gui ./

make
sudo make install
cd ../../

#End Predator dependencies

#Begin GWT
wget http://mirrors.xmission.com/eclipse/eclipse/downloads/drops/R-3.7.2-201202080800/eclipse-SDK-3.7.2-linux-gtk.tar.gz
tar -zxvf eclipse-SDK-3.7.2-linux-gtk.tar.gz

./eclipse/eclipse &> /dev/null &
python -mwebbrowser https://developers.google.com/eclipse/docs/install-eclipse-3.7 &> /dev/null &

#TODO copy gwt-dev.jar and gwt-user.jar to sentinelGWT/war/WEB-INF/lib
#End GWT

git clone https://joelgarboden@github.com/joelgarboden/OpenTLD.git gTLD

cd gTLD

cmake-gui ./
cd build/
make
cd ../../

cd ~/

svn checkout https://cedar-sentinel.googlecode.com/svn/trunk/ cedar-sentinel --username JoelG90@gmail.com

wget https://github.com/downloads/fluxer/Customizer/install.sh
chmod +x install.sh
./install.sh -i
